import { readFileSync } from 'fs';
import * as yaml from 'js-yaml';
import { join } from 'path';

const envConfigMap = {
  development: 'dev',
  production: 'prod',
};

const runningConfig = process.env.NODE_ENV;

export default () => {
  const configPath = join(
    __dirname,
    '..',
    'config',
    `application.${envConfigMap[runningConfig]}.yml`,
  );
  console.log(configPath);

  return yaml.load(readFileSync(configPath, 'utf8')) as Record<string, any>;
};
